<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="__MODES__/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__CSS__/style.css" />
		<link href="__MODES__/assets/css/codemirror.css" rel="stylesheet">
		<link rel="stylesheet" href="__MODES__/assets/css/ace.min.css" />
		<link rel="stylesheet" href="__MODES__/assets/css/font-awesome.min.css" />
		<!--[if IE 7]>
		  <link rel="stylesheet" href="__MODES__/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="__MODES__/assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="__MODES__/assets/js/jquery.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
		<![endif]-->

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='__MODES__/assets/js/jquery-2.0.3.min.js'>" + "<" + "/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
		<script type="text/javascript">
		 window.jQuery || document.write("<script src='__MODES__/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
		</script>
		<![endif]-->
		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='__MODES__/assets/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
		</script>
		<script src="__MODES__/assets/js/bootstrap.min.js"></script>
		<script src="__MODES__/assets/js/typeahead-bs2.min.js"></script>
		<!-- page specific plugin scripts -->
		<script type="text/javascript" src="__JS__/H-ui.js"></script>
		<script type="text/javascript" src="__JS__/H-ui.admin.js"></script>
		
		<script src="__MODES__/assets/laydate/laydate.js" type="text/javascript"></script>
		<script  src="__PLUGINS__/layer/layer.js"></script>
	    <script  src="__PLUGINS__/common.js"></script>
		<title>计划列表</title>
	</head>

	<body>
		<div class="page-content clearfix">
			<div id="Member_Ratings">
				<div class="d_Confirm_Order_style">
					<div class="search_style">

						<ul class="search_content clearfix">
					 		<li><label class="l_f">计划状态</label>
					 			<select name="state" id="state" style=" width:100px">
					 				<option value="">--全部类别--</option>
					 				<option value="1" {if isset($getdata.state) && $getdata.state==1}selected{/if}>--还款中--</option>
					 				<option value="2" {if isset($getdata.state) && $getdata.state==2}selected{/if}>--已完成--</option>
					 				<option value="3" {if isset($getdata.state) && $getdata.state==3}selected{/if}>--还款失败--</option>
					 			</select>
					 		</li>
					 		<li><label class="l_f">支付状态</label>
					 			<select name="type" id="type" style=" width:100px">
					 				<option value="">--全部类别--</option>
					 				<option value="0" {if isset($getdata.type) && $getdata.type==0}selected{/if}>--正常--</option>
					 				<option value="1" {if isset($getdata.type) && $getdata.type==1}selected{/if}>--需补单--</option>
					 				<!-- <option value="2" {if isset($getdata.type) && $getdata.type==2}selected{/if}>--失败--</option> -->
					 				<option value="3" {if isset($getdata.type) && $getdata.type==3}selected{/if}>--支付中--</option>
					 			</select>
					 		</li>
					    	<li><label class="l_f">搜索</label><input name="keywords" value="{$getdata.keywords?$getdata.keywords:''}" id="keywords" type="text" class="text_add" placeholder="输入会员名称、电话、计划单号" style=" width:210px"></li>
					    	<li><label class="l_f">执行订单号</label><input name="form_no" value="{$getdata.form_no?$getdata.form_no:''}" id="form_no" type="text" class="text_add" placeholder="执行订单号" style=" width:210px"></li>
							<li style="width:90px;"><button type="button" id="search" class="btn_search"><i class="icon-search"></i>查询</button></li>
							<li style="width:90px;"><button type="button" id="searchAout" class="btn_search"><i class="icon-search"></i>全部</button></li>
							<li style="width:90px;"><a class="btn btn-xs btn-danger" href="/admin/repayment/index.html?state=1&type=1">异常订单</a></li>
						</ul>
					</div>
					<div class="amounts_style">
						<div class="transaction_Money clearfix">
							<div class="Money">
								<span>还款总额：{$count.count1}元</span>
								<p>统计每访问期1个小时更新一次</p>
							</div>
							<div class="Money">
								<span><em>￥</em>{$count.today1}元</span>
								<p>当天成交额</p>
							</div>
							<div class="Money">
								<span>总手续费：{$count.count_fee}(利润：{$count.count_fee_lr})元</span>
								<p>统计每访问期1个小时更新一次</p>
							</div>
						</div>
						<div class="transaction_Money clearfix">
							<div class="Money"><span>消费总额：{$count.count2}元</span>
								<p>统计每访问期1个小时更新一次</p>
							</div>
							<div class="Money"><span><em>￥</em>{$count.today2}元</span>
								<p>当天成交额</p>
							</div>
							<div class="Money"><span><em>￥</em>{$count.today_fee}元</span>
								<p>当天手续费</p>
							</div>
						</div>
					</div>
					<div class="table_menu_list">
						<table class="table table-striped table-bordered table-hover" >
							<thead>
								<tr>
									<th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
									<th>ID</th>
									<th>通道</th>
									<th>计划单号</th>
									<th>用户</th>
									<th>手机</th>
									<th>还款金额</th>
									<th>总手续费</th>
									<th>当前手续费</th>
									<th>开始时间</th>
									<th>结束时间</th>
									<th>执行时间</th>
									<th>还款笔数</th>
									<th>消费笔数</th>
									<th>费率</th>
									<th>银行名称</th>
									<th>当前订单状态</th>
									<th>状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								{volist name='list' id='v' }
									<tr>
										<td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
										<td>{$v.mission_id}</td>
										<td title="{$v.payment_name}[{$v.payment_id}]">{$v.channel_name}</td>
										<td title="{$v.mission_time|date='Y-m-d H:i:s'}">{$v.mission_form_no}</td>
										<td title="{$v.mission_uid}">{$v.user_name}</td>
										<td>{$v.user_phone}</td>
										<td>{$v.mission_money}</td>
										<td>{$v.mission_fee}</td>
										<td>{$v.mission_at_fee}</td>
										<td>
											{$v.mission_start_time}
										</td>
										<td>
											{$v.mission_end_time}
										</td>
										<!-- <td>{$v.mission_time}</td> -->
										<td>
											<!-- {php} $time = date('Y-m-d H:i:s');{/php}
											{if $v['mission_pay_time'] < $time && $v.mission_state==1 && $v.mission_type==0}
											<a href="javascript:;" title="发起支付" data-url="{:Url('pay/Task/index')}?id={$v['mission_id']}&type=1" data-confirm="您确认要发起支付吗？"  class="link-confirm btn btn-xs btn-warning">{$v.mission_pay_time}</a>
											{else}
											{$v.mission_pay_time}
											{/if}
											 -->
											{$v.mission_pay_time}
										</td>
										<td>
											{$v.mission_repayment_number}/{$v.mission_repayment}
										</td>
										<td>
											{$v.mission_consume_number}/{$v.mission_consume}
										</td>
										<td>{$v.mission_rate*100}%+{$v.mission_close_rate}</td>
										<td title="[{$v.list_id}-{$v.card_id}]">{$v.list_name}</td>
										<td>
											{if $v.mission_current_state==1}
												<a href="javascript:;" title="还款" data-url="{:Url('Admin/Repayment/current_state')}?id={$v['mission_id']}&type=2" data-confirm="您确认要更改为消费状态吗？"  class="link-confirm btn btn-xs btn-info">还款</a>
											{elseif $v.mission_current_state==2}
												<a href="javascript:;" title="消费" data-url="{:Url('Admin/Repayment/current_state')}?id={$v['mission_id']}&type=1" data-confirm="您确认要更改为还款状态吗？"  class="link-confirm btn btn-xs btn-warning">消费</a>
											{/if}
										</td>
										<td>
											{switch v.mission_state}
											    {case 1}
												    {if $v.mission_type==1 || $v.mission_type==2}
														<font color="red">需补单</font>
														<a href="javascript:;" title="修改为正常状态" data-url="{:Url('Admin/Repayment/type')}?id={$v['mission_id']}&type=99" data-confirm="您确认要修改为正常状态吗？"  class="link-confirm btn btn-xs btn-danger">修改为正常状态</a>
													{elseif $v.mission_type==3}
														处理中
													{else}
												    	还款中
													{/if}
											    {/case}
											    {case 2}已完成{/case}
											    {case 3}<font color="red">失败</font>{/case}
											    {case 4}<font color="red">用户终止计划</font>{/case}
											    {case 5}<font color="red">未及时付款</font>{/case}
											    {case 6}<font color="red">后台关闭计划</font>{/case}
											    {default /}未启动
											{/switch}
										</td>
										<td>
											<a title="计划明细" href="javascript:;" onclick="detail('{$v.mission_id}')" class="btn btn-xs btn-success">
												计划明细
											</a>
											{if $v.mission_state==1}
												<a href="javascript:;" title="关闭计划" data-url="{:Url('Admin/Repayment/close')}?id={$v['mission_id']}&type=1" data-confirm="您确认要关闭计划吗？"  class="link-confirm btn btn-xs btn-danger">关闭计划</a>
											{elseif $v.mission_state==0 || $v.mission_state>2}
												<a href="javascript:;" title="启用计划" data-url="{:Url('Admin/Repayment/close')}?id={$v['mission_id']}&type=0" data-confirm="您确认要启用计划吗？"  class="link-confirm btn btn-xs btn-success">启用计划</a>
											{/if}

											<a href="javascript:;" title="删除计划" data-url="{:Url('Admin/Repayment/del')}?id={$v['mission_id']}&type=1" data-confirm="您确认要删除计划吗？"  class="link-confirm btn btn-xs btn-danger">删除计划</a>
										</td>
									</tr>
								{/volist}
							</tbody>
						</table>
                        {$list|raw}
					</div>
				</div>
			</div>
		</div>
	</body>

</html>
<script>
	jQuery(function($) {
		
		$('#search').on('click', function() {
			var state = $('#state').val();
			var type = $('#type').val();
			var keywords = $('#keywords').val();
			var form_no = $('#form_no').val();
			window.location.href = "{:Url('')}?state="+state+"&type="+type+"&keywords="+keywords+"&form_no="+form_no; 
		});
		
		$('#searchAout').on('click', function() {
			window.location.href = "{:Url('')}"; 
		});
		
		$('table th input:checkbox').on('click', function() {
			var that = this;
			$(this).closest('table').find('tr > td:first-child input:checkbox')
				.each(function() {
					this.checked = that.checked;
					$(this).closest('tr').toggleClass('selected');
				});

		});

		laydate({
		    elem: '#start',
		    event: 'focus' 
		});
		
		$('[data-rel="tooltip"]').tooltip({
			placement: tooltip_placement
		});

		function tooltip_placement(context, source) {
			var $source = $(source);
			var $parent = $source.closest('table')
			var off1 = $parent.offset();
			var w1 = $parent.width();

			var off2 = $source.offset();
			var w2 = $source.width();

			if(parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
			return 'left';
		}
		
		
	})

	function detail(id){
			
			layer.open({
			  type: 2,
			  title: false,
			  closeBtn: 1,
			  area: ['90%', '90%'],
			  shadeClose: true,
			  skin: 'yourclass',
			  content: '{:Url('detail')}?id='+id
			});
		}
</script>